package spider.entitys;

import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * created by yb
 * on 2017/8/9.
 * 小说章节内容的信息
 * 标题,内容,上一页,下一页,目录
 **/
public class ChapterDetail implements Serializable{
    private static final long serialVersionUID = -1959090711197670141L;
    private String tittle;
    private String content;
    private String prev;
    private String next;
    private String catalog;

    //region set get equals toString hashcode
    @Override
    public String toString() {
        return "ChapterDetail{" +
                "tittle='" + tittle + '\'' +
                ", content='" + StringUtils.abbreviate(content,30) + '\'' +  //返回前30个字符
                ", prev='" + prev + '\'' +
                ", next='" + next + '\'' +
                ", catalog='" + catalog + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ChapterDetail that = (ChapterDetail ) o;

        if (tittle != null ? !tittle.equals(that.tittle) : that.tittle != null) return false;
        if (content != null ? !content.equals(that.content) : that.content != null) return false;
        if (prev != null ? !prev.equals(that.prev) : that.prev != null) return false;
        if (next != null ? !next.equals(that.next) : that.next != null) return false;
        return catalog != null ? catalog.equals(that.catalog) : that.catalog == null;
    }

    @Override
    public int hashCode() {
        int result = tittle != null ? tittle.hashCode() : 0;
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (prev != null ? prev.hashCode() : 0);
        result = 31 * result + (next != null ? next.hashCode() : 0);
        result = 31 * result + (catalog != null ? catalog.hashCode() : 0);
        return result;
    }

    public String getTittle() {

        return tittle;
    }

    public void setTittle(String tittle) {
        this.tittle = tittle;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getPrev() {
        return prev;
    }

    public void setPrev(String prev) {
        this.prev = prev;
    }

    public String getNext() {
        return next;
    }

    public void setNext(String next) {
        this.next = next;
    }

    public String getCatalog() {
        return catalog;
    }

    public void setCatalog(String catalog) {
        this.catalog = catalog;
    }
    //endregion

}
